package pack1;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class sprg18 {
	public static void main(String[] args) throws InterruptedException {

		WebDriver driver=new FirefoxDriver();
		driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
		driver.get("http://google.com");
		
		driver.findElement(By.id("gbqfq")).sendKeys("selenium");
		Thread.sleep(1000);
		List<WebElement> allOptions = driver.findElements(By.xpath("//td/span[text()='selenium']"));
		//Select select =new Select(allOptions);
		
		int i;
		for(i=0;i<allOptions.size();i++)
		{
			if(allOptions.get(i).getText().equals("selenium ide"))
			{
			allOptions.get(i).click(); break;
			}
		}
		System.out.println(allOptions.get(i).getText()+ "selected");
	
	}
}
